package com.lzz.bottomencapsulation.mvp;

import android.app.Activity;
import android.content.Context;

import org.reactivestreams.Subscription;

import java.util.ArrayList;


/**
 * MVPPlugin
 *  邮箱 784787081@qq.com
 */

public  class LBBasePresenterImpl<V extends LBBaseView> implements LBBasePresenter<V> {
    protected V mView;
    protected Context context;
    protected Activity activity;

    protected ArrayList<Subscription> NetWorkList;
    @Override
    public void attachView(V view) {
        mView=view;
        activity=view.getActivity();
        context=view.getContext();
        NetWorkList=new ArrayList<>();
    }

    @Override
    public void detachView() {
        mView=null;
        for (int i=0;i<NetWorkList.size();i++){
            NetWorkList.get(i).cancel();
        }
    }

    @Override
    public void getSourceData() {

    }

    public V getView() {
        return mView;
    }

}
